import Vue from "vue";
import VueRouter from "vue-router";
import HomeView from "../views/HomeView.vue";

Vue.use(VueRouter);

const routes = [
  { path: "/", redirect: "/home/community" },
  {
    path: '/car-list',
    name: 'car-list',
    component: () => import('../views/CarList.vue'),
  },
  {
    path: "/sos",
    name: "sos",
    component: () => import("../views/ServiceSos.vue"),
  },
  {
    path: "/shijia",
    name: "shijia",
    component: () => import("../views/ServiceShijia.vue"),
  },
  {
    path: "/se",
    name: "se",
    component: () => import("../views/ServiceSe.vue"),
  },
  {
    path: "/park",
    name: "park",
    component: () => import("../views/ServicePark.vue"),
  },
  {
    path: "/recommend",
    name: "service",
    component: () => import("../views/Recommend.vue"),
  },
  {
    path: "/recommenddetil",
    name: "recommenddetil",
    component: () => import("../views/RecommendDetil.vue"),
  },
  {
    path: "/home",
    name: "home",
    component: HomeView,
    children: [
      {
        path: "community",
        name: "community",
        component: () => import("../views/Community.vue"),
        meta: {
          keepAlive: true,
        },
      },
      {
        path: "shopping",
        name: "shopping",
        component: () => import("../views/Shopping.vue"),
      },
      {
        path: "car",
        name: "car",
        component: () => import("../views/Car.vue"),
      },
      {
        path: "service",
        name: "service",
        component: () => import("../views/Service.vue"),
      },
      {
        path: "mine",
        name: "mine",
        component: () => import("../views/Mine.vue"),
        children: [
          {
            path: "setting",
            name: "setting",
            component: () => import("../views/mine/Setting.vue"),
          },
        ],
      },
    ],
  },
];

const router = new VueRouter({
  mode: "history",
  base: process.env.BASE_URL,
  routes,
});

export default router;
